<?php
if (!defined('ROOT_PATH')) die('No direct access.');
function view_tab($user){
	?>
	<div class="large-3 pull-9 columns">
		<p><img src="<?php echo 'https://graph.facebook.com/'.$user['idFB'].'/picture?width=320&height=240' ?>" width="320px" height="240px" alt="profile pic" /></p>
		<hr />
	  <ul class="side-nav">
		<li><a href="<?php echo PROFIL_URL."a/".$user['idFB'] ?>">Profil</a></li>
		<?php
		if (isset($_SESSION['logged'])){
			if ($user['idFB']==$_SESSION['logged']['id']) {
				echo "<li><a href=\"".PROFIL_URL."toko\">Toko</a></li>";
				echo "<li><a href=\"".PROFIL_URL."keranjang\">Keranjang</a></li>";
				echo "<li><a href=\"".PROFIL_URL."transaksi\">Transaksi</a></li>";
				echo "<li><a href=\"".PROFIL_URL."alamat\">Alamat</a></li>";
			}else if ($user['isToko']){
				echo "<li><a href=\"".PROFIL_URL."a/".$user['idFB']."/toko\">Toko</a></li>";
			}
		}else if ($user['isToko']){
				echo "<li><a href=\"".TOKO_URL."a/".$user['idFB']."/".$user['slug_nama-toko']."\">Toko</a></li>";
			}
		?>
		<li><a href="<? echo PROFIL_URL."a/".$user['idFB']."/artikel" ?>">Artikel</a></li>
	  </ul>
	</div>
	<?php
}
//------------------------------------------------------PROFIL
include('_vprofil.php');
//------------------------------------------------------ALAMAT
include('_valamat.php');
//------------------------------------------------------TRANSAKSI+KERANJANG
include('_vtrans.php');
//------------------------------------------------------TOKO
include('_vtoko.php');

function view_artikel($id){
	view_header_top();
	$user = getUser($id);
	//----------------------------------------------------------------
	$title = "Realita - ".$user['nama'];
	$content = "Realita ".$user['nama'];
	$url = PROFIL_URL."a/".$user['idFB'];
	$image = IMAGE_URL."300x240.gif";	//profpic orangnya / tokonya
	$desc = "Profil orangnya : ".$user['bio'];
	$auth = "RealiTA";
	$qwords = "profil, marketplace, umkm".$user['nama'];
	//----------------------
	echo "<title>$title</title>";
	//<!--META DATA Open Graph-->
	echo "<meta property=\"og:title\" content=\"$title\"/>";
	echo "<meta property=\"og:type\" content=\"$content\"/>";
	echo "<meta property=\"og:url\" content=\"$url\"/>";
	echo "<meta property=\"og:image\" content=\"$image\"/>";
	echo "<meta property=\"og:site_name\" content=\"RealiTA UMKM\"/>";
	echo "<meta property=\"og:description\" content=\"$desc\" />";
	//<!--META DATA FB-->
	echo "<meta property=\"fb:app_id\" content=\"147346958657510\" />";
	//<!--META DATA-->
	echo "<meta name=\"author\" content=\"$auth\" />";
	echo "<meta name=\"keywords\" content=\"$qwords\" />";
	echo "<meta name=\"description\" content=\"$desc\" />";
	echo "<meta name=\"robots\" content=\"ALL\" />";
	echo "<meta charset=\"UTF-8\" />";
	//----------------------------------------------------------------
	view_header_bottom();
	$articles = getArtikelnya($user['idPengguna']);
?>
<!-- Content -->
    <!--ul class="breadcrumbs">
	  <li><a href="#">Depan</a></li>
	  <li><a href="#">Marketplace</a></li>
	  <li><a href="#">Toko bagus</a></li>
	  <li class="current"><a href="#">Barang Bagus</a></li>
	</ul-->
	<div class="row">    
		<!-- Main Content Section -->
		<!-- This has been source ordered to come first in the markup (and on small devices) but to be to the right of the nav on larger screens -->
		<div class="large-9 push-3 columns">		  
		  <h3><?php echo $user['nama']; ?></h3>
          <hr />
          <h3>Artikel</h3>
          <?php
          foreach ($articles as $article){
			  echo "<p><a href=\"".BLOG_URL."a/".$article['idArtikel']."/".$article['slug-judul']."\">".$article['judul']."</a></p>";
		  }
          ?>
		</div>
		<!-- Nav Sidebar -->
		<!-- This is source ordered to be pulled to the left on larger screens -->
		<?php view_tab($user); ?>
	  </div>
    <!-- End Content -->
<?php
	view_footer();
}
